package TestPackageWithoutServer;

import java.beans.PropertyChangeEvent;

import java.beans.PropertyChangeListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import cmfg.GridGoL;
import cmfg.Value;
import mySocketCom.MessageHandle;
import mySocketCom.MyServer;
import mySocketCom.NowUtil;
import repast.simphony.context.Context;
import repast.simphony.engine.environment.RunEnvironment;
import repast.simphony.util.ContextUtils;

public class TestMain {
	public static void main(String[] args) {

		File file = new File(args[0]); // the scenario dir
		Value value = SetParam.setParam();
		String usernameID = "zc";
		TestRunner runner = new TestRunner(value, usernameID);
		try {
			runner.load(file); // load the repast scenario
		} catch (Exception e) {
			e.printStackTrace();
		}
		for (int i = 0; i < 2; i++) {

			runner.runInitialize();

			while (runner.getActionCount() > 0) { // loop until last action is
													// left
				if (runner.getModelActionCount() == 0) {
					runner.setFinishing(true);
				}
				runner.step(); // execute all scheduled actions at next tick

			}

			runner.stop(); // execute any actions scheduled at run end
			runner.cleanUpRun();
		}
		runner.cleanUpBatch(); // run after all runs complete
	}

}